<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">
    var date = new Date();
    document.write(date);
    var year = date.getFullYear();
    // 月份从0开始的
    var month = date.getMonth() + 1;
    var day = date.getDate(); // getDay()星期
    var hour = date.getHours();
    var minutes = date.getMinutes();
    var second = date.getSeconds();
    var ms = date.getMilliseconds();

    document.write('<br>');
    document.write(year + '-' + month + '-' + day + '-' + hour + '-' + minutes + '-' + second + '-' + ms)
</script>

</body>
</html>